import { flattedChildren } from 'element-plus/es/utils/index.mjs';
import { createRouter, createWebHistory } from 'vue-router'

const routes = [
    {
        path: '/',
        component: () => import('@/views/WelcomePage.vue'),
        meta: {
            title: '欢迎页面'
        }
    },
    {
        path: '/login',
        component: () => import('@/views/LoginPage.vue'),
        meta: {
            title: '登录页面'
        }
    },
    {
        path: '/navigation',
        component: () => import('@/views/Navigation.vue'),
        meta: {
            title: '导航页面'
        },
        redirect: '/main',
        children: [
            {
                path: '/main',
                component: () => import('@/views/MainPredictPage.vue'),
                meta: {
                    title: '主控界面',
                }
            },
            {
                path: '/database',
                component: () => import('@/views/DatabasePage.vue'),
                meta: {
                    title: '数据库展示界面',
                }
            },
            {
                path: '/model-evaluation',
                component: () => import('@/views/Evaluation.vue'),
                meta: {
                    title: '模型评估界面'
                }
            },
            {
                path: '/model-training',
                component: () => import('@/views/ModelTraining.vue'),
                meta: {
                    title: '模型训练界面'
                }
            },
            {
                path: '/ai-page',
                component: () => import('@/views/AiPage.vue'),
                meta: {
                    title: 'AI界面',
                    keepAlive: true
                }
            }
        ]
    },
    {
        path: '/user-info',
        component: () => import('@/views/UserInfoPage.vue'),
        meta: {
            title: '用户信息界面'
        }
    },
    {
        path: '/settings',
        component: () => import('@/views/Settings.vue'),
        meta: {
            title: '系统管理页面'
        }
    },
];

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router